#include <iostream>
#include<algorithm>
using namespace std;
bool cmp()
{
    return true;
}
class getnumber
{
    public:
    getnumber(int n,int k,int* arr)
    :_n(n)
    ,_k(k)
    ,_arr(arr)
    {
       
    }

    void Divarr()
    {
        sort(_arr,_arr+10);
        int flag = 0;
        int i = 4;
        while(flag <= _k)
        {
            if(_arr[i] % 2 == 0)
            {
                _arr[i] = _arr[i] / 2;
                flag++; 
                i--;
            } 
            if(i == -1)
            {
                break;
            }
        }
    }
    int getNum()
    {
        int i = 0;
        int num = 0;
        while(i < _n)
        {
            num = num + _arr[i];
            i++;
        }
        return num;
    }
    void PrintArr()
    {
        int i = 0;
        while(i < _n)
        {
            cout << _arr[i] << " ";
            i++;
        }
    }
    private:
    int _k;
    int _n;
    int* _arr;
};
int main() {
    
    int n = 0;
    int k = 0;
    cin >> n >> k;
    int arr[n];
    int cutn = 0;
    while(n > cutn)
        {
            int num = 0;
            cin >> num;
            arr[cutn] = num;
            cutn++;
        }
    getnumber test(n,k,arr);
    test.Divarr();
    test.PrintArr();
    //cout << test.getNum();
}
// 64 位输出请用 printf("%lld")